package com.kezhou.kezhoucloud.controller;

import com.kezhou.kezhoucloud.entity.AccountSt;
import com.kezhou.kezhoucloud.service.KeZhouService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class KeZhouController {
    @Autowired
    KeZhouService ks;

    /**
     * 账户管理
     */
    //登录 6-未注册 7-密码错误 10-服务器问题 13-登陆成功
    @PostMapping("/kezhou/cloud/signInCheck")
    public int signInCheck(@RequestParam("phoneNum") String phoneNum, @RequestParam("password") String password){return ks.signInCheck(phoneNum, password);}

    //获取accountId
    @PostMapping("/kezhou/cloud/getAccountId")
    public int getAccountId(@RequestParam("phoneNum") String phoneNum){return ks.getAccountId(phoneNum);}


    //发送验证码
    @PostMapping("/kezhou/cloud/getPhoneCode")
    public boolean getPhoneCode(@RequestParam("phoneNum") String phoneNum, @RequestParam("mode") int mode){return ks.getPhoneCode(phoneNum, mode);}

    //注册 4-验证码错误 5-已注册 8-服务器响应失败 11-注册成功
    @PostMapping("/kezhou/cloud/signUp")
    public int signIn(@RequestParam("phoneNum") String phoneNum, @RequestParam("mode") int mode, @RequestParam("code") String code, @RequestParam("password") String password){return ks.signUp(phoneNum, mode, code, password);}

    //找回密码 4-验证码错误 6-手机号还未注册 9-服务器响应失败 12-更改密码成功
    @PostMapping("/kezhou/cloud/resetPassword")
    public int resetPassword(@RequestParam("phoneNum") String phoneNum, @RequestParam("mode") int mode, @RequestParam("code") String code, @RequestParam("newPassword") String newPassword){return ks.resetPassword(phoneNum, mode, code, newPassword);}



}
